package com.code.client.proxy;

import java.lang.reflect.Proxy;

/**
 * @author lyf
 * @date 2021-10-10 10:48
 */
public class RpcProxyClient {

    public static <T> T clientProxy(final Class<T> interfaceCls, final String host, final int port) {
        return (T) Proxy.newProxyInstance(interfaceCls.getClassLoader(),
                new Class<?>[]{interfaceCls}, new RemoteInvokeHandler(host, port));
    }
}
